package com.kl.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.kl.domain.*;
import com.kl.em.ConstantEnum;
import com.kl.em.Result;
import com.kl.entity.CityOrder;
import com.kl.feign.LineServcieFeign;
import com.kl.feign.LogisticsStoreControllerFeign;
import com.kl.feign.StaffServiceFeign;
import com.kl.service.ICityOrderService;
import com.kl.vo.RouteVO;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.omg.CORBA.LongHolder;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author author
 * @since 2021-11-02
 */
@RestController
@RequestMapping("cityOrderController")
public class CityOrderController {

    @Autowired
    private LineServcieFeign lineServcieFeign;
    @Autowired
    private LogisticsStoreControllerFeign logisticsStoreControllerFeign;
    @Autowired
    private ICityOrderService cityOrderService;
    @Autowired
    private RedisTemplate redisTemplate;
    @Autowired
    private RocketMQTemplate rocketMQTemplate;
    @Autowired
    private StaffServiceFeign staffServiceFeign;

    //同城订单id查询接口
    @ApiOperation(value = "同城订单id查询接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id",value = "同城订单ID",required = true,paramType = "query")
    })
    @GetMapping("selectById")// @ResponseBody  将后台的数据以json的格式返回前台
    public Result<CityOrderDTO> selectById(@RequestParam("id") Long id){
        CityOrderDTO cityOrderDTO = new CityOrderDTO();
        try {
            CityOrder cityOrder = cityOrderService.getById(id);
            System.out.println(cityOrder);
            BeanUtils.copyProperties(cityOrder,cityOrderDTO);
        }catch (Exception e){
            e.printStackTrace();
            return Result.build(ConstantEnum.ERROR);
        }
        return Result.build(ConstantEnum.SUCCESS).setResult(cityOrderDTO);
    }

    //同城订单寄货人电话查询接口
    @ApiOperation(value = "同城订单寄货人电话查询接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "sendPhone",value = "寄货人电话",required = true,paramType = "query")
    })
    @GetMapping("selectBySendPhone")// @ResponseBody  将后台的数据以json的格式返回前台
    public Result<List<CityOrderDTO>> selectBySendPhone(@RequestParam("sendPhone") String sendPhone){
        List<CityOrderDTO> list = null;
        try {
            QueryWrapper wrapper = new QueryWrapper();
            wrapper.eq("sender_phone",sendPhone);
            list = cityOrderService.list(wrapper);
        }catch (Exception e){
            e.printStackTrace();
            return Result.build(ConstantEnum.ERROR);
        }
        return Result.build(ConstantEnum.SUCCESS).setResult(list);
    }

    //同城订单收货人电话查询接口
    @ApiOperation(value = "同城订单收货人电话查询接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "consigneePhone",value = "收货人电话",required = true,paramType = "query")
    })
    @GetMapping("selectByConsigneePhone")// @ResponseBody  将后台的数据以json的格式返回前台
    public Result<List<CityOrderDTO>> selectByConsigneePhone(@RequestParam("consigneePhone") String consigneePhone){
        List<CityOrderDTO> list = null;
        try {
            QueryWrapper wrapper = new QueryWrapper();
            wrapper.eq("consignee_phone",consigneePhone);
            list = cityOrderService.list(wrapper);
        }catch (Exception e){
            e.printStackTrace();
            return Result.build(ConstantEnum.ERROR);
        }
        return Result.build(ConstantEnum.SUCCESS).setResult(list);
    }

    //同城订单员工id查询执行单接口
    @ApiOperation(value = "同城订单员工id查询执行单接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "staffId",value = "接单员ID",required = true,paramType = "query")
    })
    @GetMapping("selectByStaffId")// @ResponseBody  将后台的数据以json的格式返回前台
    public Result<List<CityOrderDTO>> selectByStaffId(@RequestParam("staffId") String staffId){
        List<CityOrderDTO> list = null;
        try {
            QueryWrapper wrapper = new QueryWrapper();
            wrapper.eq("staff_id",staffId);
            wrapper.eq("goods_status",1);
            list = cityOrderService.list(wrapper);
        }catch (Exception e){
            e.printStackTrace();
            return Result.build(ConstantEnum.ERROR);
        }
        return Result.build(ConstantEnum.SUCCESS).setResult(list);
    }

    //同城订单员工id查询全部单接口
    @ApiOperation(value = "同城订单员工id查询全部单接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "staffId",value = "接单员ID",required = true,paramType = "query")
    })
    @GetMapping("selectAllByStaffId")// @ResponseBody  将后台的数据以json的格式返回前台
    public Result<List<CityOrderDTO>> selectAllByStaffId(@RequestParam("staffId") String staffId){
        List<CityOrderDTO> list = null;
        try {
            QueryWrapper wrapper = new QueryWrapper();
            wrapper.eq("staff_id",staffId);
            list = cityOrderService.list(wrapper);
        }catch (Exception e){
            e.printStackTrace();
            return Result.build(ConstantEnum.ERROR);
        }
        return Result.build(ConstantEnum.SUCCESS).setResult(list);
    }

    //同城订单同城空闲单查询接口
    @ApiOperation(value = "同城订单同城空闲单查询接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "staffId",value = "接单员ID",required = true,paramType = "query")
    })
    @GetMapping("selectByMeetStatus")// @ResponseBody  将后台的数据以json的格式返回前台
    public Result<List<CityOrderDTO>> selectByMeetStatus(@RequestParam("staffId") Long staffId){
        Result<StaffDTO> staffDTOResult = staffServiceFeign.selectByStaffId(staffId);
        if (staffDTOResult.getCode() == 1007){
            return Result.build(ConstantEnum.FaillBack);
        }else if (staffDTOResult.getCode() == 1004){
            return Result.build(ConstantEnum.ERROR);
        }
        StaffDTO staffDTO = staffDTOResult.getResult();
        Result<LogisticsStoreDTO> logResult = logisticsStoreControllerFeign.selectLogisticsStoreById(Long.parseLong(staffDTO.getSubordinateSite()));
        if (logResult.getCode() == 1007){
            return Result.build(ConstantEnum.FaillBack);
        }else if (logResult.getCode() == 1004){
            return Result.build(ConstantEnum.ERROR);
        }
        LogisticsStoreDTO result = logResult.getResult();
        Long cityId = result.getCityId();
        List<CityOrderDTO> list = null;
        try {
            QueryWrapper wrapper = new QueryWrapper();
            wrapper.eq("meet_status",0);
            wrapper.eq("spare",cityId);
            list = cityOrderService.list(wrapper);
        }catch (Exception e){
            e.printStackTrace();
            return Result.build(ConstantEnum.ERROR);
        }
        return Result.build(ConstantEnum.SUCCESS).setResult(list);
    }

    //同城订单增加接口
    @ApiOperation(value = "同城订单增加接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "cityOrderDTO",value = "同城订单实体类",required = true,paramType = "body")
    })
    @PostMapping// @ResponseBody  将后台的数据以json的格式返回前台
    public Result insertById(@RequestBody CityOrderDTO cityOrderDTO){// @RequestBody  将前端传入的json格式的数据绑定到实体类
        try {
            cityOrderDTO.setSenderName("张三龙");
            cityOrderDTO.setSenderPhone("12345");
            cityOrderDTO.setSenderAddress("北京科技职业学院");
            cityOrderDTO.setConsigneeName("李四弱");
            cityOrderDTO.setConsigneePhone("98745");
            cityOrderDTO.setConsigneeAddress("北京天安门");
            cityOrderDTO.setCargoName("三条十渠");
            cityOrderDTO.setPaymentStatus(2);//支付状态 (0未支付  1审核  2.已支付  3.驳回  4.到付)
            cityOrderDTO.setSignReceipt("0");//签收单默认为0（不返回）   用户如果需要签收单则返回，价格+20
            SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            Date date = df.parse("2021-11-04 15:00:00");
            cityOrderDTO.setDoorTime(date);//上门时间
            cityOrderDTO.setRemarks("备注信息");//备注信息
            cityOrderDTO.setOrderCreationtime(new Date());//订单创建时间
            cityOrderDTO.setOrderUpdatetime(new Date()); //订单修改时间
            cityOrderDTO.setTermsPayment(1);//默认为1（即付）  用户需要修改为2（到付）
            /*cityOrderDTO.setDeliveryTime(new Date()); //发货时间
            cityOrderDTO.setTransactionCompletiontime(new Date());//交易完成时间
            cityOrderDTO.setClosingTime(new Date()); //交易关闭时间
            cityOrderDTO.setLogisticsName("物流名称"); //物流名称
            cityOrderDTO.setOrderOverdue(1); */
            /*cityOrderDTO.setSerialNumber("支付宝流水号");//支付宝流水号
            cityOrderDTO.setAlyOrderNumber("支付宝订单号"); //支付宝订单号*/
            /*cityOrderDTO.setNearestSite("最近站点"); //暂时没用
            cityOrderDTO.setStaffId(123456L);//接单员工*/
            /*cityOrderDTO.setOrderNewsPriceEnd(new BigDecimal(100));//代收货款实收金额*/
            cityOrderDTO.setGoodsStatus(0);//货物物流状态 (0未取件，1已发货，2运输中，3已签收)
            cityOrderDTO.setMeetStatus(0);//接单状态（0等待接单，1已被接单，2超时无人接单）
            Result<RouteVO> result = lineServcieFeign.selectNameCity(cityOrderDTO.getSenderAddress(), cityOrderDTO.getConsigneeAddress());
            if (result.getCode() == 1007){
                return Result.build(ConstantEnum.FaillBack);
            }else if (result.getCode() == 1004){
                return Result.build(ConstantEnum.ERROR);
            }
            //两者之间的距离
            long distance = Long.parseLong(result.getResult().getDistance()) / 1000;//线路长度
            List list = result.getResult().getRoute();
            String site = list.get(0).toString();//站点
            Result<List<LogisticsStoreDTO>> listResult = logisticsStoreControllerFeign.selectByCityName(site);
            if (listResult.getCode() == 1007){
                return Result.build(ConstantEnum.FaillBack);
            }else if (result.getCode() == 1004){
                return listResult.build(ConstantEnum.ERROR);
            }
            List<LogisticsStoreDTO> logList = listResult.getResult();
            cityOrderDTO.setSiteName(String.valueOf(logList.get(0).getId())); //站点名称
            cityOrderDTO.setSpare(logList.get(0).getCityId().toString()); //站点所在城市
            //起步价16（含五公里） 之后没五公里 + 10
            if (distance <= 5){
                cityOrderDTO.setBehalfConllection(new BigDecimal(16));
            }else {
                cityOrderDTO.setBehalfConllection(new BigDecimal(16 + ((distance - 5) / 5 + 10)));
            }//物流费
            if (cityOrderDTO.getSignReceipt().equals(0)  && cityOrderDTO.getSignReceipt() != null){
                cityOrderDTO.setBehalfConllection(cityOrderDTO.getBehalfConllection().add(new BigDecimal(20)));
            }
            cityOrderDTO.setCargoNewsPrice(cityOrderDTO.getBehalfConllection());//代收货款应收金额
            CityOrder cityOrder = new CityOrder();
            BeanUtils.copyProperties(cityOrderDTO,cityOrder);
            boolean b = cityOrderService.save(cityOrder);
            System.out.println(cityOrder.getId());
            String id = cityOrder.getId().toString();
            //订单增加之后将订单id保存都redis中，然后将订单推送给司机，准备抢单送货
            redisTemplate.opsForValue().set(id,1);//仅当hashKey不存在时才设置；
            //同城订单发布之后使用rocketmq发送一个延时消息，如果30分钟无司机抢单，就强制派单
            SendResult send = rocketMQTemplate.syncSend("kulunwuliu-samecity", MessageBuilder.withPayload(id).build(),2000,2);
            System.out.println(send);
        }catch (Exception e){
            e.printStackTrace();
            return Result.build(ConstantEnum.ERROR);
        }
        return Result.build(ConstantEnum.SUCCESS);
    }

    //同城订单修改寄件人信息接口
    @ApiOperation(value = "同城订单修改寄件人信息接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id",value = "同城订单id",required = true,paramType = "query"),
            @ApiImplicitParam(name = "consigneeName",value = "收货人姓名",required = false,paramType = "query"),
            @ApiImplicitParam(name = "consigneePhone",value = "收货人电话",required = false,paramType = "query"),
            @ApiImplicitParam(name = "consigneeAddress",value = "收货人地址",required = false,paramType = "query")
    })
    @PutMapping("updateConsigneeById")
    public Result updateConsigneeById(@RequestParam("id")Long id,
                                    @RequestParam(required = false)String consigneeName,
                                    @RequestParam(required = false)String consigneePhone,
                                    @RequestParam(required = false)String consigneeAddress){
        try{
            CityOrderDTO cityOrderDTO = new CityOrderDTO();
            CityOrder cityOrder1 = cityOrderService.getById(id);
            BeanUtils.copyProperties(cityOrder1,cityOrderDTO);
            if (consigneeName != null && !"".equals(consigneeName)){
                cityOrderDTO.setConsigneeName(consigneeName);
            }
            if (consigneePhone != null && !"".equals(consigneePhone)){
                cityOrderDTO.setConsigneePhone(consigneePhone);
            }
            if (consigneeAddress != null && !"".equals(consigneeAddress)){
                cityOrderDTO.setConsigneeAddress(consigneeAddress);
            }
            System.out.println(cityOrderDTO);
            Result<RouteVO> result = lineServcieFeign.selectNameCity(cityOrderDTO.getSenderAddress(), cityOrderDTO.getConsigneeAddress());
            if (result.getCode() == 1007){
                return Result.build(ConstantEnum.FaillBack);
            }
            cityOrderDTO.setOrderUpdatetime(new Date());
            long distance = Long.parseLong(result.getResult().getDistance()) / 1000;//线路长度
            List list = result.getResult().getRoute();
            String site = list.get(0).toString();//站点
            Result<List<LogisticsStoreDTO>> listResult = logisticsStoreControllerFeign.selectByCityName(site);
            if (listResult.getCode() == 1007){
                return Result.build(ConstantEnum.FaillBack);
            }
            List<LogisticsStoreDTO> logList = listResult.getResult();
            cityOrderDTO.setSiteName(String.valueOf(logList.get(0).getId())); //站点名称
            cityOrderDTO.setSpare(logList.get(0).getCityId().toString()); //站点所在城市
            //起步价16（含五公里） 之后没五公里 + 10
            if (distance <= 5){
                cityOrderDTO.setBehalfConllection(new BigDecimal(16));
            }else {
                cityOrderDTO.setBehalfConllection(new BigDecimal(16 + ((distance - 5) / 5 + 10)));
            }//物流费
            if (cityOrderDTO.getSignReceipt().equals(0)  && cityOrderDTO.getSignReceipt() != null){
                cityOrderDTO.setBehalfConllection(cityOrderDTO.getBehalfConllection().add(new BigDecimal(20)));
            }
            cityOrderDTO.setCargoNewsPrice(cityOrderDTO.getBehalfConllection());//代收货款应收金额
            CityOrder cityOrder = new CityOrder();
            BeanUtils.copyProperties(cityOrderDTO,cityOrder);
            cityOrderService.updateByCityOrderId(cityOrder);
        }catch (Exception e){
            e.printStackTrace();
            return Result.build(ConstantEnum.ERROR);
        }
        return Result.build(ConstantEnum.SUCCESS);
    }

    //同城订单接单成功接口
    @ApiOperation(value = "同城订单接单成功接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id",value = "同城订单id",required = true,paramType = "query"),
            @ApiImplicitParam(name = "staffId",value = "接单员工id",required = true,paramType = "query")
    })
    @PutMapping("updateConsigneeBySuccess")
    public Result updateConsigneeBySuccess(@RequestParam("id")Long id,
                                    @RequestParam("staffId")Long staffId){
        CityOrderDTO cityOrderDTO = new CityOrderDTO();
        try{
            cityOrderDTO.setId(id);
            cityOrderDTO.setStaffId(staffId);
            cityOrderDTO.setOrderUpdatetime(new Date());
            cityOrderDTO.setGoodsStatus(1);
            cityOrderDTO.setMeetStatus(2);
            CityOrder cityOrder = new CityOrder();
            BeanUtils.copyProperties(cityOrderDTO,cityOrder);
            cityOrderService.updateByCityOrderId(cityOrder);
            System.out.println("发送短信,提醒骑手接单成功,尽快按时上门取货");
        }catch (Exception e){
            e.printStackTrace();
            return Result.build(ConstantEnum.ERROR);
        }
        return Result.build(ConstantEnum.SUCCESS);
    }

    //同城订单接单员已取货接口
    @ApiOperation(value = "同城订单接单员已取货接口（当面付款，需传流水号和订单号）")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id",value = "同城订单id",required = true,paramType = "query"),
            @ApiImplicitParam(name = "serialNumber",value = "支付宝流水号",required = true,paramType = "query"),
            @ApiImplicitParam(name = "alyOrderNember",value = "支付宝订单号",required = true,paramType = "query")
    })
    @PutMapping("updatePickedUp")
    public Result updatePickedUp(@RequestParam("id")Long id,
                                 @RequestParam("serialNumber")String serialNumber,
                                 @RequestParam("alyOrderNember")String alyOrderNember){
        CityOrderDTO cityOrderDTO = new CityOrderDTO();
        try{
            cityOrderDTO.setId(id);
            cityOrderDTO.setOrderUpdatetime(new Date()); //订单更新时间
            cityOrderDTO.setGoodsStatus(2);  //2表示已经取货，正在派送中
            cityOrderDTO.setTransactionCompletiontime(new Date()); //交易完成时间，也就是付款时间
            cityOrderDTO.setSerialNumber(serialNumber); //支付宝流水号
            cityOrderDTO.setAlyOrderNumber(alyOrderNember); //支付宝订单号
            CityOrder cityOrder = new CityOrder();
            BeanUtils.copyProperties(cityOrderDTO,cityOrder);
            cityOrderService.updateByCityOrderId(cityOrder);
            System.out.println("发短信提醒送货员请及时送货");
        }catch (Exception e){
            e.printStackTrace();
            return Result.build(ConstantEnum.ERROR);
        }
        return Result.build(ConstantEnum.SUCCESS);
    }

    //同城订单完成接口
    @ApiOperation(value = "同城订单完成接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id",value = "同城订单id",required = true,paramType = "query")
    })
    @PutMapping("updateCompletion")
    public Result updateCompletion(@RequestParam("id")Long id){
        CityOrderDTO cityOrderDTO = new CityOrderDTO();
        try{
            cityOrderDTO.setId(id);
            cityOrderDTO.setOrderUpdatetime(new Date());
            cityOrderDTO.setGoodsStatus(3);  //3表示已签收
            cityOrderDTO.setClosingTime(new Date()); //交易关闭时间
            CityOrder cityOrder = new CityOrder();
            BeanUtils.copyProperties(cityOrderDTO,cityOrder);
            cityOrderService.updateByCityOrderId(cityOrder);
        }catch (Exception e){
            e.printStackTrace();
            return Result.build(ConstantEnum.ERROR);
        }
        return Result.build(ConstantEnum.SUCCESS);
    }

    //同城订单超时接口
    @ApiOperation(value = "同城订单超时接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id",value = "同城订单id",required = true,paramType = "query")
    })
    @PutMapping("updateOvertime")
    public Result updateOvertime(@RequestParam("id")Long id){
        CityOrderDTO cityOrderDTO = new CityOrderDTO();
        try{
            cityOrderDTO.setId(id);
            cityOrderDTO.setOrderUpdatetime(new Date());
            cityOrderDTO.setMeetStatus(2); //超时无人接
            CityOrder cityOrder = new CityOrder();
            BeanUtils.copyProperties(cityOrderDTO,cityOrder);
            cityOrderService.updateByCityOrderId(cityOrder);
        }catch (Exception e){
            e.printStackTrace();
            return Result.build(ConstantEnum.ERROR);
        }
        return Result.build(ConstantEnum.SUCCESS);
    }

    //同城订单退单接口
    @ApiOperation(value = "同城订单退单接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id",value = "同城订单id",required = true,paramType = "query")
    })
    @PutMapping("updateChargeback")
    public Result updateChargeback(@RequestParam("id")Long id){
        CityOrderDTO cityOrderDTO = new CityOrderDTO();
        try{
            cityOrderDTO.setId(id);
            cityOrderDTO.setOrderUpdatetime(new Date());
            cityOrderDTO.setMeetStatus(3); //用户已退单
            CityOrder cityOrder = new CityOrder();
            BeanUtils.copyProperties(cityOrderDTO,cityOrder);
            cityOrderService.updateByCityOrderId(cityOrder);
        }catch (Exception e){
            e.printStackTrace();
            return Result.build(ConstantEnum.ERROR);
        }
        return Result.build(ConstantEnum.SUCCESS);
    }

    //同城派送员抢单接口 (因为在员工查询同城订单的时候已经限制了只能查看同城订单，所以在这就不做判断了)
    @ApiOperation(value = "同城派送员抢单接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id",value = "同城订单id",required = true,paramType = "query"),
            @ApiImplicitParam(name = "staffId",value = "同城送货员id",required = true,paramType = "query"),
    })
    @PutMapping("grabOder")
    public Result grabOder(@RequestParam("id")Long id,@RequestParam("staffId")Long staffId){
        //判断redis中是否有这个key，如果没有，直接返回操作失败，如果有，就删除当前的key，然后执行相关的逻辑
        String string = id.toString();
        if (redisTemplate.hasKey(string)){
            redisTemplate.opsForValue().decrement(string,1);
            String l = (String) redisTemplate.opsForValue().get(string);
            if ("0" == l || "0".equals(l)){
                try {
                    CityOrderDTO cityOrderDTO = new CityOrderDTO();
                    cityOrderDTO.setId(id);
                    cityOrderDTO.setStaffId(staffId);
                    cityOrderDTO.setOrderUpdatetime(new Date());
                    cityOrderDTO.setGoodsStatus(1);
                    cityOrderDTO.setMeetStatus(2);
                    CityOrder cityOrder = new CityOrder();
                    BeanUtils.copyProperties(cityOrderDTO,cityOrder);
                    cityOrderService.updateByCityOrderId(cityOrder);
                    System.out.println("发送短信,提醒骑手接单成功,尽快按时上门取货");
                    redisTemplate.delete(string);
                    return Result.build(ConstantEnum.SUCCESS);
                }catch (Exception e){
                    e.printStackTrace();
                    redisTemplate.opsForValue().increment(string,1);
                    return Result.build(ConstantEnum.ERROR);
                }
            }
        }
        return Result.build(ConstantEnum.ROB_ERROR);
    }
    /*//站点查询接口
    @ApiOperation(value = "站点查询")
    @PostMapping("selectByAddress")// @ResponseBody  将后台的数据以json的格式返回前台
    public Result selectByAddress(){
        Result<LineDTO> result1 = lineServcieFeign.selectByBoth("北京","天津");
        LineDTO result = result1.getResult();
        if (result1.getCode() == 1007){
            return Result.build(ConstantEnum.FaillBack);
        }else if (result1.getCode() == 1000){
            return Result.build(ConstantEnum.SUCCESS).setResult(result);
        }else {
            return Result.build(ConstantEnum.ERROR);
        }
    }*/
}
